package com.lc.hongtai.fragment;


import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.lc.hongtai.MyApplication;
import com.lc.hongtai.R;
import com.lc.hongtai.activity.CompanyIntroduceActivity;
import com.lc.hongtai.activity.ContactActivity;
import com.lc.hongtai.activity.FeedBackActivity;
import com.lc.hongtai.activity.HezuoActivity;
import com.lc.hongtai.activity.SecurityActivity;
import com.lc.hongtai.activity.SettingsActivity;
import com.lc.hongtai.activity.TeamIntroduceActivity;
import com.zcx.helper.activity.AppV4Fragment;
import com.zcx.helper.bound.BoundViewHelper;


/**
 * A simple {@link Fragment} subclass.
 */
public class FourthFragment extends AppV4Fragment implements View.OnClickListener {
    private LinearLayout layout_team_introduce;
    private LinearLayout layout_feedback;
    private LinearLayout layout_settings;
    //安全保障
    private LinearLayout layout_security;
    //联系我们
    private LinearLayout layout_contactus;
    //公司介绍
    private LinearLayout layout_introduce_company;
    //合作单位
    private LinearLayout layout_hezuo;
    Intent intent;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = BoundViewHelper.boundView(this, MyApplication.scaleScreenHelper.loadView((ViewGroup) inflater.inflate(R.layout.fragment_fourth, null)));
        initView(view);
        intent = new Intent();
        return view;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

    }


    public void initView(View view) {
        layout_team_introduce = (LinearLayout) view.findViewById(R.id.layout_team_introduce);
        layout_team_introduce.setOnClickListener(this);

        layout_feedback = (LinearLayout) view.findViewById(R.id.layout_feedback);
        layout_feedback.setOnClickListener(this);

        layout_settings = (LinearLayout) view.findViewById(R.id.layout_settings);
        layout_settings.setOnClickListener(this);

        layout_security = (LinearLayout) view.findViewById(R.id.layout_security);
        layout_security.setOnClickListener(this);

        layout_contactus = (LinearLayout) view.findViewById(R.id.layout_contactus);
        layout_contactus.setOnClickListener(this);

        layout_introduce_company = (LinearLayout) view.findViewById(R.id.layout_introduce_company);
        layout_introduce_company.setOnClickListener(this);
//合作单位
        layout_hezuo = (LinearLayout) view.findViewById(R.id.layout_hezuo);
        layout_hezuo.setOnClickListener(this);

    }


    @Override
    public void onResume() {
        super.onResume();
        if (MyApplication.canClean) {

        } else {
            MyApplication.canClean = false;
        }

    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {


            //团队介绍
            case R.id.layout_team_introduce:
//                startActivity(new Intent(getActivity(), TeamIntroduceActivity.class));

             //   intent.putExtra("url", "http://vhost602.zihaistar.com/api/index/article_content?id=" + "42" + "&show_type=article");
                intent.setClass(getActivity(), TeamIntroduceActivity.class);
                startActivity(intent);

                break;
            case R.id.layout_feedback:
                startActivity(new Intent(getActivity(), FeedBackActivity.class));

                break;

            case R.id.layout_settings:

                startActivity(new Intent(getActivity(), SettingsActivity.class));
                break;

            case R.id.layout_security:
                startActivity(new Intent(getActivity(), SecurityActivity.class));
                break;

            //联系我们
            case R.id.layout_contactus:
                startActivity(new Intent(getActivity(), ContactActivity.class));

                break;

            case R.id.layout_introduce_company:
                //startActivity(new Intent(getActivity(), CompanyIntroduceActivity.class));
                Intent intent = new Intent();
              //  intent.putExtra("url", "http://vhost602.zihaistar.com/api/index/article_content?id=" + "30" + "&show_type=article");
                intent.setClass(getActivity(), CompanyIntroduceActivity.class);
                startActivity(intent);

                break;
            //合作单位
            case R.id.layout_hezuo:
                startActivity(new Intent(getActivity(), HezuoActivity.class));
                break;

        }
    }
}
